package com.uzai.common.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 设备类 - 群
 */
public enum DeviceTypeGroupEnum {

    /**
     * 个人微信群配置
     */
    PRIVATE_WECHAT_GROUP(100,"private_wechat_group","个人微信群配置", "个人微信群配置"),

    /**
     * 企业微信群配置
     */
    WORK_WECHAT_GROUP(102,"work_wechat_group","企业微信群配置", "企业微信群配置"),

    /**
     * 抖音群配置
     */
    TIKTOK_GROUP(108,"tiktok_group","抖音群配置", "抖音群配置"),


    ;

    public static final int PRIVATE_WECHAT_GROUP_VALUE = 7;
    public static final int WORK_WECHAT_GROUP_VALUE = 8;

    private Integer id;
    private String key;
    private String desc;
    private String remark;
    DeviceTypeGroupEnum(Integer id, String key, String desc, String remark) {
        this.id = id;
        this.key = key;
        this.desc = desc;
        this.remark = remark;
    }
    public Integer getId() {
        return id;
    }
    public String getKey() {
        return key;
    }
    public String getDesc() {
        return desc;
    }
    public String getRemark() {
        return remark;
    }

    public static DeviceTypeGroupEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (DeviceTypeGroupEnum type: DeviceTypeGroupEnum.values()) {
            if (type.getId().intValue() == id) {
                return type;
            }
        }
        return null;
    }
    public static DeviceTypeGroupEnum getByKey(String key) {
        if (StringUtils.isBlank(key)) {
            return null;
        }
        for (DeviceTypeGroupEnum type: DeviceTypeGroupEnum.values()) {
            if (type.getKey().equals(key)) {
                return type;
            }
        }
        return null;
    }
}
